package com.rising.spring.chain;

import java.util.List;

public class Chain {
    private List<ChainHanlder> hanlders;

    private int index = 0;

    public Chain(List<ChainHanlder> hanlders) {
        this.hanlders = hanlders;
    }

    public void proceed() {
        if (index >= hanlders.size()) {
            return;
        }
        hanlders.get(index++).execute(this);
    }
}
